/**
 * 订单状态常量
 */
export const ORDER_STATUS = {
  PENDING: 0,    // 待付款
  PAID: 1,       // 待发货
  SHIPPED: 2,    // 待收货
  COMPLETED: 3,  // 已完成
  CANCELLED: 4,  // 已取消
  REFUNDING: 5,  // 退款中
  REFUNDED: 6    // 已退款
};

/**
 * 获取订单状态文本
 * @param {number} status 状态码
 * @returns {string} 状态文本
 */
export function getOrderStatusText(status) {
  switch (status) {
    case ORDER_STATUS.PENDING: return '待付款';
    case ORDER_STATUS.PAID: return '待发货';
    case ORDER_STATUS.SHIPPED: return '待收货';
    case ORDER_STATUS.COMPLETED: return '已完成';
    case ORDER_STATUS.CANCELLED: return '已取消';
    case ORDER_STATUS.REFUNDING: return '退款中';
    case ORDER_STATUS.REFUNDED: return '已退款';
    default: return '未知状态';
  }
}

/**
 * 获取订单状态类型（用于Element UI的Tag组件）
 * @param {number} status 状态码
 * @returns {string} 状态类型
 */
export function getOrderStatusType(status) {
  switch (status) {
    case ORDER_STATUS.PENDING: return 'info';
    case ORDER_STATUS.PAID: return 'warning';
    case ORDER_STATUS.SHIPPED: return 'primary';
    case ORDER_STATUS.COMPLETED: return 'success';
    case ORDER_STATUS.CANCELLED: return 'danger';
    case ORDER_STATUS.REFUNDING: return 'warning';
    case ORDER_STATUS.REFUNDED: return 'info';
    default: return 'info';
  }
} 